package cn.itsource.mq.sender;

import cn.itsource.mq.MQApplication;
import cn.itsource.mq.config.RabbitmqConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = MQApplication.class)
public class Sender {

    @Autowired
    RabbitTemplate rabbitTemplate;

    @Test
    public void testSendMsg(){
        rabbitTemplate.convertAndSend(
                RabbitmqConfig.EXCHANGE_TOPICS_INFORM,   //交换机
                "email.xxxx.WWWW",
                "我是一个email消息,over!!!"
        );

    }

}
